package site.xuxingcan;

import site.xuxingcan.Model.CardModel;
import site.xuxingcan.Model.OperationModel;
import site.xuxingcan.Model.UserCardModel;
import site.xuxingcan.Util.CheckWinUtil;
import site.xuxingcan.Util.Log;

import java.util.ArrayList;
import java.util.Collections;

public class Main {

    public static void main(String[] args) {
        // write your code here
        ArrayList<CardModel> cardModelArrayList = new ArrayList<>();
        for (int type = 1; type <= 3; type++) {
            for (int number = 1; number <= 9; number++) {
                for (int i = 0; i < 4; i++) {
                    cardModelArrayList.add(new CardModel(type, number));
                }
            }
        }
        Collections.shuffle(cardModelArrayList);
        Log.d(cardModelArrayList.size() + "");
        ArrayList<UserCardModel> userCardModelArrayList = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            ArrayList<CardModel> currentCardModels = new ArrayList<>();
            for (int j = 0; j < 13; j++) {
                currentCardModels.add(cardModelArrayList.remove(0));
            }
            Collections.sort(currentCardModels);
            userCardModelArrayList.add(new UserCardModel("user" + (i + 1), currentCardModels));
        }
        for (UserCardModel userCardModel : userCardModelArrayList) {
            Log.d(userCardModel.getUserName());
            for (CardModel cardModel : userCardModel.getCurrentCardModels()) {
                System.out.print(cardModel.toString() + "    ");
            }
            System.out.println();
        }
        Log.d(cardModelArrayList.size() + "");
//        cardModelArrayList.clear();
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 6));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 6));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 6));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 7));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 7));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 7));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 8));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 8));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 8));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_TIAO, 9));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_TIAO, 9));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 5));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 5));
//        cardModelArrayList.add(new CardModel(CardModel.TYPE_BING, 5));
//        CheckWinUtil.checkWin(cardModelArrayList);
//        OperationModel operationModel = new OperationModel();
//        Log.d(CheckWinUtil.checkSan(operationModel, cardModelArrayList) + "   " + operationModel.getSame() + "   " + operationModel.getShunzi() + "   " + operationModel.getOperationTimes());
    }
}
